<?php

class My_CommissionRole {
	
	const ROLE_NOT_SET = 0;
	const PREDSEDA = 1;
	const MIESTOPREDSEDA = 2;
	const TAJOMNIK = 3;
	const CLEN = 4;
	
	private $_role;
	
	private static $_roleTypes = array(
		self::ROLE_NOT_SET => 'neurčené',
		self::PREDSEDA => 'predseda',
		self::MIESTOPREDSEDA => 'miestopredseda',
		self::TAJOMNIK => 'tajomník',
		self::CLEN => 'člen komisie'		
	);
		
	
	function __construct($role) {
		
		$this->setRole($role);
		
	}
	
	
	/**
	 * @param $_role the $_role to set
	 */
	public function setRole($role) {
		
		if(!isset(self::$_roleTypes[$role])){
			throw new My_Exception("Role doesn't exist");
			return false;
		}
		
		$this->_role = $role;
	}

	
	/**
	 * @return the $_role
	 */
	public function getRole() {
		return $this->_role;
	}
	
	public function getRoleName(){
		
		return self::$_roleTypes[$this->getRole()];
		
	}
	
	/**
	 * 
	 * @return array
	 */
	public static function getAllRoleTypes(){
		return self::$_roleTypes;
	}
}